package com.example.usermanager.service;

import com.example.usermanager.mapper.UserMapper;
import com.example.usermanager.model.UserInfo;
import org.apache.catalina.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserService {
    @Resource
    private UserMapper userMapper;

    public UserInfo login(String loginname , String password){
        return userMapper.login(loginname , password);
    }

    public List<UserInfo> getAll(){
        return userMapper.getAll();
    }

    public int add(UserInfo userInfo){
        return userMapper.add(userInfo);
    }

    public UserInfo getUserByLoginname(String loginname){
        return userMapper.getUserByLoginname(loginname);
    }

    public UserInfo getUserByUid(Integer uid){
        return userMapper.getUserByUid(uid);
    }

    public int updateUser(UserInfo userInfo){
        return userMapper.updateUser(userInfo);
    }

    public int delById(Integer uid){
        return userMapper.delById(uid);
    }

    public int delByIds(List<Integer> ids){
        return userMapper.delByIds(ids);
    }

    public List<UserInfo> getListByPage(String username,String address, String email,Integer limit, Integer offset){
        return userMapper.getListByPage(username, address, email, limit, offset);
    }

    public int getCountByPage(String username,String address,String email){
        return userMapper.getCountByPage(username, address, email);
    }
}
